// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

// 全部加载
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

// 按需加载
// import { Button, Message } from 'element-ui'
// Vue.component(Button.name, Button)
// Vue.prototype.$message = Message


Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})


//路由守卫

router.beforeEach((to, from, next) => {
    console.log('beforeEach', to, from)
    // if(to.meta.title){
    //     document.title = to.meta.title
    // }else{
    //     document.title = 'hello world'
    // }
    next()
})

router.beforeResolve((to, from, next) => {
    console.log('beforeResolve', to, from)
    next()
})

router.afterEach((to, from) => {
    console.log('afterEach', to, from)
})

